<?php
#基础函数
include_once('_path.php');
include_once("../includes/init.php");

#获取页面变量
$action = trim($_GET['action']);
$id= trim($_REQUEST['id']) + 0;
	$quote['id'] = string_sql($id);
#如果有group_id
if ($id > 0) {
	$sql = "SELECT * FROM feedback WHERE id=$id";
	$_feedback = $database->queryFirst($sql);
	if (!$_feedback['id']) {
		$_REQUEST['referrer'] = "index.php";
		redirect("记录不存在!");
	}
}

#如果是编辑
if ($action == "view.form") {
        $uid = $_feedback['id'];
	$name = $_feedback['name'];
        $tel = $_feedback['tel'];
	$birthday = $_feedback['birthday'];
	$nation = $_feedback['nation'];
	$email = $_feedback['email'];
        $company = $_feedback['company'];
		$service = $_feedback['service'];
        $staff= $_feedback['staff'];
	$qq = $_feedback['qq'];
	$address = $_feedback['address'];
        $web = $_feedback['web'];
	$promocode= $_feedback['promocode'];
	$message = $_feedback['message'];
}
#如果是添加操作
else if ($action == "delete.do" && $id > 0) {
	#删除反馈信息
	$database->execute("DELETE FROM feedback WHERE id = ".$quote['id'].";");
        $_REQUEST['referrer'] = "index.php";
        redirect("删除反馈信息成功!");
}
#样式
$css = array();
$js = array();
#菜单
$menu = "feedback";
include_once("../layout/_header.php");
?>
        <div class="main">
       		<div class="traininc-nav-list">
				<ul>
<li><a href="<?= _CONST_BACKEND_URL ?>/feedback/index.php">反馈列表</a></li>
<li class="selected"><a href="javascript:;">反馈详细</a></li>
				</ul>
		</div>
<?php
if ($action == "view.form") {
?>
<form action="edit.php?action=edit.form" method="post" id="form" name="form">
<input type="hidden" name="id" value="<?= $id ?>">
			<div class="box-con">
				<table class="table-view">
                                    	<tr>
						<td class="title">姓名</td>
						<td><?= htmlspecialchars($name) ?></td>
						<td class="title">电话</td>
						<td><?= htmlspecialchars($tel) ?></td>
					</tr>
					<tr>
						<td class="title">出生年月</td>
						<td><?= htmlspecialchars($birthday) ?></td>
						<td class="title">民族</td>
						<td><?= htmlspecialchars($nation) ?></td>
					</tr>
					<tr>
						<td class="title">电子邮件</td>
						<td><?= htmlspecialchars($email) ?></td>
						<td class="title">公司名称</td>
						<td><?= htmlspecialchars($company) ?></td>
					</tr>
					<tr>
						<td class="title">服务</td>
						<td><?= htmlspecialchars($service) ?></td>
						<td class="title">员工人数</td>
						<td><?= htmlspecialchars($staff) ?></td>
					</tr>
					<tr>
						<td class="title">qq</td>
						<td><?= htmlspecialchars($qq) ?></td>
						<td class="title">网站</td>
						<td><?= htmlspecialchars($web) ?></td>
					</tr>
					<tr>
						<td class="title">地点</td>
						<td><?= htmlspecialchars($address) ?></td>
						<td class="title">促销代码</td>
						<td><?= htmlspecialchars($promocode) ?></td>
					</tr>
					<tr>
						<td class="title">留言</td>
						<td><?= htmlspecialchars($message) ?></td>
						<td class="title"></td>
						<td></td>
					</tr>
				</table>
			</div>
    </form>
<?php
}
?>
        </div>
<?
include_once("../layout/_footer.php");
?>